﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            initData();
        }
        private void initData()
        {
            List<NongTrai>dsNT = new List<NongTrai>();
            NongTrai n1 = new NongTrai();
            n1.MaSo = 1;
            n1.TenNongTrai = "Nong Trai thu";
            dsNT.Add(n1);

            NongTrai n2 = new NongTrai();
            n2.MaSo = 2;
            n2.TenNongTrai = "Nong Trai cay";
            dsNT.Add(n2);

            comboBox1.DataSource = dsNT;
            comboBox1.ValueMember = "MaSo";
            comboBox1.DisplayMember = "TenNongTrai";

            listBox1.DataSource = dsNT;
            listBox1.ValueMember = "MaSo";
            listBox1.DisplayMember = "TenNongTrai";
        }
    }
}
